<?php

namespace addons\qingdong\model;

use think\Model;

/**
 *跟进阅读记录
 */
class RecordRead Extends Model {
    // 表名,不含前缀
    protected $name = 'qingdong_record_read';
	// 开启自动写入时间戳字段
	protected $autoWriteTimestamp = 'int';
	// 定义时间戳字段名
	protected $createTime = 'createtime';
	protected $updateTime = 'updatetime';


	//添加阅读记录
	public static function addRead($record_id, $staff_id) {
		return self::create([ 'record_id' => $record_id, 'staff_id' => $staff_id]);
	}


	//是否阅读
	public static function isRead($record_id, $staff_id) {
		if (self::where(['record_id' => $record_id, 'staff_id' => $staff_id])->find()) {
			return 1;
		}

		return 0;
	}
}
